package demo;

import java.util.*;

/**
 * @Author liangzai
 * @Description:
 */
public class Training {
    //直线
    public static void main1(String[] args) {
        HashSet<Map<Double,Double>> lines = new HashSet<>();
        List<Map<Integer,Integer>> list = new ArrayList<>();

        for (int i = 0; i < 20; i++) {
            for (int j = 0; j < 21; j++) {
                Map<Integer,Integer> map = new HashMap<>();
                map.put(i,j);
                list.add(map);
            }
        }

        //得到两个直线点
        double x1=0,x2=0,y1=0,y2=0;
        for (int i = 0; i < list.size(); i++) {
            for (int j = i+1; j < list.size(); j++) {
                for (Map.Entry<Integer, Integer> entry : list.get(i).entrySet()) {
                    x1 = entry.getKey();
                    y1 = entry.getValue();
                }
                for (Map.Entry<Integer, Integer> entry : list.get(j).entrySet()) {
                    x2 = entry.getKey();
                    y2 = entry.getValue();
                }

                if (x1 == x2 || y1 == y2) {
                    continue;
                }

                double k = (y2 - y1) / (x2 - x1);
                double b = (x2 * y1 - x1 * y2) / (x2 - x1);
                Map<Double, Double> temp = new HashMap<>();
                temp.put(k, b);
                lines.add(temp);
            }
        }
        System.out.println(lines.size()+20+21);
    }


    public static void main(String[] args) {
        Set<String> set = new HashSet<>();
        for (int x1 = 0; x1 < 20; x1++) {
            for (int x2 = 0; x2 < 20; x2++) {
                for (int y1 = 0; y1 < 21; y1++) {
                    for (int y2 = 0; y2 < 21; y2++) {
                        if(x1==x2 || y1==y2){
                            continue;
                        }
                        String line = "y = ";
                        int x = x2 - x1;
                        int y = y2 - y1;
                        int d = gcd(x,y);
                        String k = x/d + "/" + y/d;
                        line += k + "x + ";
                        int m = y2 * x1 - y1 * x2;
                        int n = gcd(m, x);
                        line += m / n + "/" + x / n;

                        set.add(line);

                    }
                }
            }
        }
        System.out.println(set.size()+20+21);
        System.out.println(40257);
    }

    private static int gcd(int x, int y){
        return x%y==0?y:gcd(y,x%y);
    }

}






















